

package examples.basic;

import commandz.cli.*;
import commandz.var.*;
import java.util.Collection;


/**
 *  Implementation of the Command-interface that just echoes its
 *  name and provided arguments to the standard output-stream.
 */
public class EchoCommand implements Command
{
    private final String COMMAND_NAME = "echo";
    private final String COMMAND_DESCRIPTION = "Echoes its name and the provided arguments.";

    protected VariableInteger first = new VariableInteger();
    protected VariableInteger second = new VariableInteger();
    protected VariableBoolean third = new VariableBoolean();


    public String getName()
    {
        return this.COMMAND_NAME;
    }


    public String getDescription()
    {
        return this.COMMAND_DESCRIPTION;
    }


    public void publishParameters(Collection<Parameter> params)
    {
        params.add(new Parameter(this.first, "first", "The first parameter."));
        params.add(new Parameter(this.second, "second", "The second parameter."));
        params.add(new Parameter(this.third, "third", "And.. what a surprise: another parameter!"));
    }


    public void execute()
    {
        System.out.println("first  = " + this.first.getValue());
        System.out.println("second = " + this.second.getValue());
        System.out.println("third  = " + this.third.getValue());
    }
}
